import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace OrderPaymentRecordApi {
  /** 订单支付记录信息 */
  export interface OrderPaymentRecord {
    id: number; // 
    paymentId?: string; // 支付ID
    orderId?: string; // 订单ID
    paymentType: string; // 支付类型(DEPOSIT/BALANCE/FULL)
    paymentAmount?: number; // 支付金额
    paymentMethod: string; // 支付方式
    paymentStatus: string; // 支付状态
    paymentTime: string | Dayjs; // 支付时间
    refundAmount: number; // 退款金额
  }
}

/** 查询订单支付记录分页 */
export function getOrderPaymentRecordPage(params: PageParam) {
  return requestClient.get<PageResult<OrderPaymentRecordApi.OrderPaymentRecord>>('/wedding/order-payment-record/page', { params });
}

/** 查询订单支付记录详情 */
export function getOrderPaymentRecord(id: number) {
  return requestClient.get<OrderPaymentRecordApi.OrderPaymentRecord>(`/wedding/order-payment-record/get?id=${id}`);
}

/** 新增订单支付记录 */
export function createOrderPaymentRecord(data: OrderPaymentRecordApi.OrderPaymentRecord) {
  return requestClient.post('/wedding/order-payment-record/create', data);
}

/** 修改订单支付记录 */
export function updateOrderPaymentRecord(data: OrderPaymentRecordApi.OrderPaymentRecord) {
  return requestClient.put('/wedding/order-payment-record/update', data);
}

/** 删除订单支付记录 */
export function deleteOrderPaymentRecord(id: number) {
  return requestClient.delete(`/wedding/order-payment-record/delete?id=${id}`);
}


/** 导出订单支付记录 */
export function exportOrderPaymentRecord(params: any) {
  return requestClient.download('/wedding/order-payment-record/export-excel', { params });
}

